<?php

namespace App\Modules\System\Models;


use Illuminate\Database\Eloquent\Model;

/**
 * Class Notice  系统通知
 * @package App\Modules\Task\Models
 */
class Notice extends Model
{
    protected $table = 'notice';

    protected $fillable = ['id','recipient_id', 'title', 'is_reading', 'content', 'created_at', 'updated_at', 'status'];


    static function getList($param)
    {
        return self::where('recipient_id','=',0)->orWhere('recipient_id','=',$param['user_id'])->orderBy('created_at','desc')->paginate();
    }


    static function getNotice($id)
    {
        return self::where('id',$id)->first();
    }


    static function addNotice($param)
    {
        // TODO check
        return self::create($param);
    }


    static function updateNotice($param)
    {
        // TODO check
        return self::where('id',$param['id'])->update($param);
    }

}